import { defineStore } from 'pinia'

export interface SeoState {
    title: string
    keywords: string
    description: string
}

export const useSeo = defineStore('seo', {
    state: (): SeoState => ({
        title: '',
        keywords: '',
        description: ''
    }),
    actions: {
        setSeo(data: Partial<SeoState>) {
            this.title = data.title ?? this.title
            this.keywords = data.keywords ?? this.keywords
            this.description = data.description ?? this.description
        },
        reset() {
            this.title = ''
            this.keywords = ''
            this.description = ''
        },
    },
    persist: true,
})